home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / apport / gcc_ice_hook < prev    next >
Encoding:
Text File  |  2009-09-25  |  1.1 KB  |  35 lines

  1. #!/usr/bin/python
  2. #
  3. # Collect information about a gcc internal compiler exception (ICE).
  4. #
  5. # Copyright (c) 2007 Canonical Ltd.
  6. # Author: Martin Pitt <martin.pitt@ubuntu.com>
  7. #
  8. # This program is free software; you can redistribute it and/or modify it
  9. # under the terms of the GNU General Public License as published by the
  10. # Free Software Foundation; either version 2 of the License, or (at your
  11. # option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
  12. # the full text of the license.
  13.  
  14. import sys
  15. import apport, apport.fileutils
  16.  
  17. # parse command line arguments
  18. if  len(sys.argv) != 3:
  19.     print >> sys.stderr, 'Usage:', sys.argv[0], '<executable name> <gcc -E output file>'
  20.     print >> sys.stderr, 'If "-" is specified as second argument, the preprocessed source is read from stdin.'
  21.     sys.exit(1)
  22.  
  23. (exename, sourcefile) = sys.argv[1:]
  24.  
  25. # create report
  26. pr = apport.Report()
  27. pr['ExecutablePath'] = exename
  28. if sourcefile == '-':
  29.     pr['PreprocessedSource'] = (sys.stdin, False)
  30. else:
  31.     pr['PreprocessedSource'] = (open(sourcefile), False)
  32.  
  33. # write report
  34. pr.write(open(apport.fileutils.make_report_path(pr), 'w'))
  35.